package org.fang.springschudleshedlock;

import cn.hutool.core.date.DateUtil;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class CronService {

    @SchedulerLock(name = "a")
    @Scheduled(cron = "*/5 * * * * *")
    public void a() throws InterruptedException {
        System.out.println(DateUtil.now());
        Thread.sleep(2000L);
    }

}
